package com.example.demo.service.Impl;

import com.example.demo.mapper.RemittanceMapper;
import com.example.demo.pojo.HellLog;
import com.example.demo.pojo.Lifebook;
import com.example.demo.pojo.Remittance;
import com.example.demo.service.RemittanceService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class RemittanceServiceImpl implements RemittanceService {
    @Autowired
    private RemittanceMapper remittanceMapper;
    //汇款添加
    @Override
    public void remittanceAdd(Remittance remittance) {
        remittance.setCreate_time(LocalDateTime.now());
        remittanceMapper.remittanceAdd(remittance);
    }

    @Override
    public void remittanceUpdatelifebook(Remittance remittance) {
        remittanceMapper.remittanceUpdatelifebook(remittance);
    }

    @Override
    public Remittance remittanceSelectlifebook(Remittance remittance) {
        return remittanceMapper.remittanceSelectlifebook(remittance);
    }
    //汇款列表查询
    @Override
    public PageInfo remittanceSelect(Integer page,Integer limit,Remittance remittance) {
        //    1.获取总记录数
        PageHelper.startPage(page,limit);
        //    2.执行操作
        List<Remittance> list = remittanceMapper.remittanceSelect(remittance);
        PageInfo<Remittance> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
    //汇款总数查询
    @Override
    public Integer remittanceSelectCount() {
        return remittanceMapper.remittanceSelectCount();
    }
    //汇款记录删除
    @Override
    public void remittanceDelete(Integer id) {
        remittanceMapper.remittanceDelete(id);
    }
}
